package form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class AddProductForm extends ActionForm {
	/**
	 * 
	 */
	private static final long serialVersionUID = 4986753728183994046L;
	private String nom = "";
	private String codeBarre = "";
	private int marge = 0;
	private int nombreStock = 0;
	private int nombreRayon = 0;
	private int prixHT = 0;
	private int prixTTC = 0;
	private int idRayon = 0;
	private int quantity = 0;
	private int seuilMiniRayon = 0;
	private int seuilMiniStock = 0;
	private int TVA = 0;
	
	
	public ActionErrors validate(ActionMapping mapping, HttpServletRequest req) 
	{
		ActionErrors errors = new ActionErrors ();
		if (this.nom.length() == 0)	
			errors.add("name", new ActionMessage("personne.formulaire.name.vide"));
		if (this.codeBarre.length() == 0)	
			errors.add("name", new ActionMessage("personne.formulaire.name.vide"));
		
		return errors;
	}
	
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		//              reset our field
		nom = "";
		codeBarre = "";
		marge = 0;
		nombreStock = 0;
		nombreRayon = 0;
		prixHT = 0;
		prixTTC = 0;
		idRayon = 0;
		quantity = 0;
		seuilMiniRayon = 0;
		seuilMiniStock = 0;
		TVA = 0;
	}

	
	
	public String getCodeBarre() {
		return codeBarre;
	}
	public void setCodeBarre(String codeBarre) {
		this.codeBarre = codeBarre;
	}
	public int getIdRayon() {
		return idRayon;
	}
	public void setIdRayon(int idRayon) {
		this.idRayon = idRayon;
	}
	public int getMarge() {
		return marge;
	}
	public void setMarge(int marge) {
		this.marge = marge;
	}
	public String getNom() {
		return nom;
	}
	public void setNom(String nom) {
		this.nom = nom;
	}
	public int getNombreRayon() {
		return nombreRayon;
	}
	public void setNombreRayon(int nombreRayon) {
		this.nombreRayon = nombreRayon;
	}
	public int getNombreStock() {
		return nombreStock;
	}
	public void setNombreStock(int nombreStock) {
		this.nombreStock = nombreStock;
	}
	public int getPrixHT() {
		return prixHT;
	}
	public void setPrixHT(int prixHt) {
		this.prixHT = prixHt;
	}
	public int getSeuilMiniRayon() {
		return seuilMiniRayon;
	}
	public void setSeuilMiniRayon(int seuilMiniRayon) {
		this.seuilMiniRayon = seuilMiniRayon;
	}
	public int getSeuilMiniStock() {
		return seuilMiniStock;
	}
	public void setSeuilMiniStock(int seuilMiniStock) {
		this.seuilMiniStock = seuilMiniStock;
	}


	public int getPrixTTC() {
		return prixTTC;
	}


	public void setPrixTTC(int prixTTC) {
		this.prixTTC = prixTTC;
	}


	public int getQuantity() {
		return quantity;
	}


	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}


	public int getTVA() {
		return TVA;
	}


	public void setTVA(int tva) {
		TVA = tva;
	}
	
}
